<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //class extends 的继承
    class Person {
      constructor(name, age) {
        this.name = name
        this.age = age
      }
      jump() {
        console.log('会跳')
      }
    }

    class Teacher extends Person {
      constructor(name, age, lesson) {
        super(name, age)     //exends中必须调用super()
        this.lesson = lesson
        console.log('构造函数执行了')
      }
      sayHello() {
        console.log('打招呼')
      }
    }

    let teaher1 = new Teacher('12', '12', '12')
    console.log(teaher1)
  </script>
</body>

</html>